import request from '@/config/axios'

// IM消息 VO
export interface MemberMessageVO {
  id: number // 编号
  groupId: number // 分组ID
  sendUserId: number // 发送人编号
  receiveUserId: number // 接收人编号
  contentType: number // 消息类型
  content: string // 消息
  voiceSec: number // 语音时长
  imgWidth: number // 图片宽度
  imgHeight: number // 图片高度
  readStatus: boolean // 是否已读
}

// IM消息 API
export const MemberMessageApi = {
  // 查询IM消息分页
  getMemberMessagePage: async (params: any) => {
    return await request.get({ url: `/im/member-message/page`, params })
  },

  // 查询IM消息详情
  getMemberMessage: async (id: number) => {
    return await request.get({ url: `/im/member-message/get?id=` + id })
  },

  // 新增IM消息
  createMemberMessage: async (data: MemberMessageVO) => {
    return await request.post({ url: `/im/member-message/create`, data })
  },

  // 修改IM消息
  updateMemberMessage: async (data: MemberMessageVO) => {
    return await request.put({ url: `/im/member-message/update`, data })
  },

  // 删除IM消息
  deleteMemberMessage: async (id: number) => {
    return await request.delete({ url: `/im/member-message/delete?id=` + id })
  },

  // 导出IM消息 Excel
  exportMemberMessage: async (params) => {
    return await request.download({ url: `/im/member-message/export-excel`, params })
  },
}